﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Data;
using PolePositionMobileUtilityData;
using System.Data.SqlServerCe;
using PolePositionMobileUtilityEntity;
using PolePositionMobileUtilityGeneral;

namespace PolePositionMobileUtilityLogic
{
    public class LNote
    {
        public static List<ENote> GetByInspectionResult(int resultId)
        {
            DataTable _dt = DNote.GetByInspectionResult(resultId);
            List<ENote> _noteList = new List<ENote>();
            ENote _note;
            foreach (DataRow dr in _dt.Rows)
            {
                _note = new ENote(ConvertMobileHelper.ToInt32(dr["NoteFk"]), ConvertMobileHelper.Tostring(dr["Note_Name"]));
                _noteList.Add(_note);
            }
            return _noteList;
        }

        public static void DeleteByInspectionResult(int inspectionResult, SqlCeTransaction tr)
        {
            DNote.DeleteNoteByInspectionResult(inspectionResult, tr);
        }

        public static void Insert(List<ENote> notes,int resultId, SqlCeTransaction tr)
        {
            foreach (ENote n in notes)
            {
                DNote.Insert(n.Id, resultId, tr);
            }
        }
    }
}
